<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>出租车管理系统</title>
    <link rel="icon" href="/img/logo.png" type="image/x-icon"/>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/admin/index.css">
    <script src="/script/jquery-3.3.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <script>
        layui.use(['layer','form','table','element'],function () {
            var layer = layui.layer
                ,form = layui.form
                ,table =layui.table
                ,element = layui.element;

            $("#cacelBtn").bind("click",function () {
                parent.layui.element.tabDelete("tabs","toPayView");
            })

            $("#payed").bind("click",function () {
                var type = $("#type").val();
                var id = $("#id").val();

                $.ajax({
                    type:"post"
                    ,url:"/driver/pay"
                    ,data:{
                        "id":id
                        ,"type":type
                    }
                    ,success:function (res) {
                        if(res.flag){
                            //支付成功
                            layer.confirm(res.message, {
                                btn: ['确定',] //按钮
                            }, function(){
                                parent.layui.element.tabDelete("tabs","toPayView");
                            });
                        }else{
                            layer.msg(res.message);
                        }
                    }
                    ,error:function () {
                        layer.msg("系统错误！");
                    }
                });

            })


        });
    </script>
</head>
<body>
    <input type="hidden" id="id" th:value="${id}">
    <input type="hidden" id="type" th:value="${type}">
    <div class="layui-container">
        <form id="form"  >
            <div class="layui-row">
                <img src="/img/wx.jpg" width="300px" height="300px" >
            </div>
            <div class="layui-row layui-col-md-offset1">
                <br>
                <a class="layui-btn layui-btn-normal" id="payed">已付款</a>
                <a class="layui-btn layui-btn-danger" id="cacelBtn">取消付款</a>
            </div>


        </form>
    </div>

</body>
</html>